package com.example.demo.utils;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.demo.mapper.CompetitionMapper;
import com.example.demo.pojo.Competitions.Competitions;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class CompetitionUtils {
    @Resource
    private CompetitionMapper competitionMapper;

    public boolean getCompetitionStatus(int id, int status) {
        //判断比赛是否结束
        QueryWrapper<Competitions> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("competition_id", id).eq("status", status);
        return competitionMapper.selectOne(queryWrapper) == null;
    }
}
